(in-package :lilu-terminal-example)

(defun test-htop1 (&optional user)
  (dolist (term (lilu-app:list-all-terminals :installed-p t))
    (if user
          (open-terminal :cmd (format nil "htop -u ~s" user) :terminal term :wait-p t)
          (open-terminal :cmd "htop" :terminal term :wait-p t))))

(defun test-htop2 (&optional user)
  (dolist (term (lilu-app:list-all-terminals :installed-p t))
    (let ((*terminal* (find-terminal term)))
      (format *debug-io* "=> ~A ~%" *terminal*)
      (if user
          (open-terminal :cmd (format nil "htop -u ~s" user)
                         :wait-p t)
          (open-terminal :cmd "htop"
                         :wait-p t)))))

(defun test-htop3 (&optional user)
  (dolist (term (lilu-app:list-all-terminals :installed-p t))
    (let ((*terminal* term))
      (format *debug-io* "=> ~A ~%" *terminal*)
      (if user
          (open-terminal :cmd (format nil "htop -u ~s" user)
                         :wait-p t)
          (open-terminal :cmd "htop"
                         :wait-p t)))))

(defun test-htop4 (&optional user)
  (dolist (term (lilu-app:list-all-terminals :installed-p t))
    (use-terminal term)
    (format *debug-io* "=> ~A ~%" *terminal*)
    (if user
        (exec-terminal-command (format nil "htop -u ~s" user)
                               :wait-p t)
        (exec-terminal-command (format nil "htop")
                               :wait-p t))))
